-module(wrsd).
-behaviour(application).

-export([start/2, stop/1, start_phase/3, update_loop/0]).

start(_Type, Args) -> wrsd_sup:start_link(Args).

stop(_State) -> ok.

start_phase(update_loop, _, _) ->
    spawn(?MODULE, update_loop, []),
    ok.

update_loop() ->
    spawn(fun() -> [wrsd_realmserver:write(Realm) || Realm <- wrsd_realm:process(us)] end),
    timer:sleep(60000 * 10),
    wrsd:update_loop().

